<?php
include("utils.php");
if($_SESSION['siteuserId']=="")
{
	header("location:index.php");
}
if($_POST['mode']=="delete_landing_page")
{
	delete_landing_page();
}
else
{
	main_content("main();");
}

function delete_landing_page()
{
 $delete_sql="delete from adspace_landing_page where landingId='".$_POST['landingId']."' ";
 mysql_query($delete_sql);

 $file1='landing_page/landing_'.$_POST['landingId'].'.php';
unlink("$file1");
$GLOBALS['msg']="Landing page deleted successfully.";
main_content("main();");
}
function main()
{
?>
<script language="JavaScript">
function choose_template(argu)
{

	if(argu=='Templates')
	{
		document.getElementById('table_box').style.display='block';
	}
	else
	{
		document.getElementById('table_box').style.display='none';
	}
}

function delete_landing_page(landingId)
		{
			var FAQResp = window.confirm("Are you sure to remove the selected landing page ?");
			if( FAQResp == true )
			{
				
				document.getElementById('mode').value='delete_landing_page';
				document.getElementById('landingId').value=landingId;
				//add_price
				document.getElementById('landing_page_form').submit();
			}
		}

</script>

<!--<form name="landing_page_form" method="POST" action="" id="landing_page_form">-->
  <input type="hidden" name="mode" id="mode" value="">
  <input type="hidden" name="landingId" id="landingId" value="">
  <div id="control" style="width: auto; padding-top: 5px; padding-bottom: 15px;">
    <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td valign="top" align="center"><table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">
            <tr>
              <td width="20%" valign="top"><?php include_once("left_pannel.php"); ?></td>
			  <td width="10px">&nbsp;</td>
              <td valign="top">
				<form name="landing_page_form" method="POST" action="" id="landing_page_form">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="11"><img src="images/PinkBorderTopLeft.jpg" alt="" width="11" height="11"></td>
                          <td class="PinkBoxTopBg"><img src="images/spacer.gif" alt="" width="10" height="11"></td>
                          <td width="11"><img src="images/PinkBorderTopRight.jpg" alt="" width="11" height="11"></td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr>
                    <td class="PinkTwosideBorder BoxContent" valign="top" align="center">
					<table width="98%" class="center" cellspacing="0" cellpadding="0">
                        <tr>
                          <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td><table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
                                    <?php
									if($GLOBALS['msg']!="")
									{
									?>
                                    <tr>
                                      <td align="center" valign="top" class="drop_downTxt" style="padding-bottom:15px;"><?php echo $GLOBALS['msg'];?> </td>
                                    </tr>
                                    <?php
									}
									?>
                                    <tr>
                                      <td align="left" valign="top" class="drop_downTxt"> Create Landing Page from:
                                        <select name="langing" class="drop_downBox" onchange="return choose_template(this.value);">
                                          <option value="">--Select--</option>
                                          <option value="Templates">Templates</option>
											<?php
											$sql_landing_page="select pageName,landingId from adspace_landing_page where UserId='".$_SESSION['siteuserId']."' ";
											
											$query_landing_page=mysql_query($sql_landing_page);
											while($rec_landing_page=mysql_fetch_array($query_landing_page))
											{
											?>
											  <option value="<?php echo $rec_landing_page['pageName'];?>"><?php echo $rec_landing_page['pageName'];?></option>
											  <?php
												}
											?>
                                        </select>
                                      </td>
                                    </tr>
                                    <tr>
                                      <td align="left" valign="top" class="table_box" >
										<div style="display:none;" id="table_box">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                          
                                          <tr>
                                            <td><img src="images/spacer.gif" alt="" height="14" /></td>
                                          </tr>
                                          <tr>
                                            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                  <!-- 1st table box -->
                                                  <td align="left" valign="top" width="138"><table width="138" border="0" cellspacing="0" cellpadding="0">
                                                      <tr>
                                                        <td><img src="images/box_table_ltop.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxTop"></td>
                                                        <td><img src="images/box_table_rtop.jpg" alt="" /></td>
                                                      </tr>
                                                      <tr>
                                                        <td class="table_boxLSide"></td>
                                                        <td class="table_boxMidd"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                              <td align="left" class="table_boxHeadingTxt">Click-2-Call</td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center"><img src="images/0.gif" alt="" /></td>
                                                            </tr>
                                                            <tr>
                                                              <td align="left" valign="top" class="table_boxTxt table_boxHeight"> Create a page that allows customers to contact you directly via a phone call. </td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center" class="build"><input name="" type="button" value="Build" onClick="javascript:window.location='click-2-call.php?tab=buy_ads&subMenu=4';"  /></td>
                                                            </tr>
                                                          </table></td>
                                                        <td class="table_boxRSide"></td>
                                                      </tr>
                                                      <tr>
                                                        <td><img src="images/box_table_lbot.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxBot"></td>
                                                        <td><img src="images/box_table_rbot.jpg" alt="" /></td>
                                                      </tr>
                                                    </table></td>
                                                  <!-- /1st table box -->
                                                  <td width="12">&nbsp;</td>
                                                  <!-- 2nd table box -->
                                                  <td align="left" valign="top" width="138"><table width="138" border="0" cellspacing="0" cellpadding="0">
                                                      <tr>
                                                        <td><img src="images/box_table_ltop.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxTop"></td>
                                                        <td><img src="images/box_table_rtop.jpg" alt="" /></td>
                                                      </tr>
                                                      <tr>
                                                        <td class="table_boxLSide"></td>
                                                        <td class="table_boxMidd"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                              <td align="left" class="table_boxHeadingTxt">Lead Generation</td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center"><img src="images/1.gif" alt="" /></td>
                                                            </tr>
                                                            <tr>
                                                              <td align="left" valign="top" class="table_boxTxt table_boxHeight"> Create a page on which customers can enter email address or phone number. </td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center" class="build"><input name="" type="button" value="Build" onClick="javascript:window.location='lead_generation.php?tab=buy_ads&subMenu=4';" /></td>
                                                            </tr>
                                                          </table></td>
                                                        <td class="table_boxRSide"></td>
                                                      </tr>
                                                      <tr>
                                                        <td><img src="images/box_table_lbot.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxBot"></td>
                                                        <td><img src="images/box_table_rbot.jpg" alt="" /></td>
                                                      </tr>
                                                    </table></td>
                                                  <!-- /2nd table box -->
                                                  <td width="12">&nbsp;</td>
                                                  <!-- 3rd table box -->
                                                  <td align="left" valign="top" width="138"><table width="138" border="0" cellspacing="0" cellpadding="0">
                                                      <tr>
                                                        <td><img src="images/box_table_ltop.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxTop"></td>
                                                        <td><img src="images/box_table_rtop.jpg" alt="" /></td>
                                                      </tr>
                                                      <tr>
                                                        <td class="table_boxLSide"></td>
                                                        <td class="table_boxMidd"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                              <td align="left" class="table_boxHeadingTxt">Mobile Flyer</td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center"><img src="images/2.gif" alt="" /></td>
                                                            </tr>
                                                            <tr>
                                                              <td align="left" valign="top" class="table_boxTxt table_boxHeight"> Create a page that explains your product or service. </td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center" class="build"><input name="" type="button" value="Build" onClick="javascript:window.location='mobile_flyer.php?tab=buy_ads&subMenu=4';" /></td>
                                                            </tr>
                                                          </table></td>
                                                        <td class="table_boxRSide"></td>
                                                      </tr>
                                                      <tr>
                                                        <td><img src="images/box_table_lbot.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxBot"></td>
                                                        <td><img src="images/box_table_rbot.jpg" alt="" /></td>
                                                      </tr>
                                                    </table></td>
                                                  <!-- /3rd table box -->
                                                  <td width="12">&nbsp;</td>
                                                  <!-- 4th table box -->
                                                  <td align="left" valign="top" width="138"><table width="138" border="0" cellspacing="0" cellpadding="0">
                                                      <tr>
                                                        <td><img src="images/box_table_ltop.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxTop"></td>
                                                        <td><img src="images/box_table_rtop.jpg" alt="" /></td>
                                                      </tr>
                                                      <tr>
                                                        <td class="table_boxLSide"></td>
                                                        <td class="table_boxMidd"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                              <td align="left" class="table_boxHeadingTxt">RSS Feed</td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center"><img src="images/3.gif" alt="" /></td>
                                                            </tr>
                                                            <tr>
                                                              <td align="left" valign="top" class="table_boxTxt table_boxHeight"> Create a page that pulls content from an RSS feed. </td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center" class="build"><input name="" type="button" value="Build" onClick="javascript:window.location='rss_feed.php?tab=buy_ads&subMenu=4';" /></td>
                                                            </tr>
                                                          </table></td>
                                                        <td class="table_boxRSide"></td>
                                                      </tr>
                                                      <tr>
                                                        <td><img src="images/box_table_lbot.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxBot"></td>
                                                        <td><img src="images/box_table_rbot.jpg" alt="" /></td>
                                                      </tr>
                                                    </table></td>
                                                  <!-- /4th table box -->
                                                  <td width="12">&nbsp;</td>
                                                  <!-- 5th table box -->
                                                  <td align="left" valign="top" width="138"><table width="138" border="0" cellspacing="0" cellpadding="0">
                                                      <tr>
                                                        <td><img src="images/box_table_ltop.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxTop"></td>
                                                        <td><img src="images/box_table_rtop.jpg" alt="" /></td>
                                                      </tr>
                                                      <tr>
                                                        <td class="table_boxLSide"></td>
                                                        <td class="table_boxMidd"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                              <td align="left" class="table_boxHeadingTxt">Custom</td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center"><img src="images/-1.gif" alt="" /></td>
                                                            </tr>
                                                            <tr>
                                                              <td align="left" valign="top" class="table_boxTxt table_boxHeight"> Create a custom page with any number of modules. </td>
                                                            </tr>
                                                            <tr>
                                                              <td align="center" class="build"><input name="" type="button" value="Build" onClick="javascript:window.location='custom.php?tab=buy_ads&subMenu=4';" /></td>
                                                            </tr>
                                                          </table></td>
                                                        <td class="table_boxRSide"></td>
                                                      </tr>
                                                      <tr>
                                                        <td><img src="images/box_table_lbot.jpg" alt="" /></td>
                                                        <td width="130" class="table_boxBot"></td>
                                                        <td><img src="images/box_table_rbot.jpg" alt="" /></td>
                                                      </tr>
                                                    </table></td>
                                                  <!-- /5th table box -->
                                                </tr>
                                              </table></td>
                                          </tr>
                                        </table>
										</div>
										</td>
                                    </tr>
                                  </table></td>
                              </tr>
                              <tr>
                                <TD><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td class="txtboxTxt"> Landing Pages </td>
                                    </tr>
                                  </table></TD>
                              </tr>
                              <tr>
                                <TD style="padding-top:20px;"><table width="100%" cellspacing="1" cellpadding="0" border="1">
                                    <TR>
                                      <TD align="center"><table width="100%" class="login_txt" cellspacing="1" cellpadding="0" border="0">
                                          <tr>
                                            <td class="listHeader" align="center" width="40%">Name</td>
                                            <td class="listHeader" align="center" width="20%">Type</td>
                                            <td class="listHeader" align="center" width="20%">Created on</td>
                                            <td class="listHeader" align="center" width="20%">Delete</td>
                                          </tr>
                                          <?php
	$sql_landing_page_list="select * from adspace_landing_page where UserId='".$_SESSION['siteuserId']."' ";
	$query_landing_page_list=mysql_query($sql_landing_page_list);
	$num_landing_page_list=mysql_num_rows($query_landing_page_list);
	if($num_landing_page_list>0)
	{
	$loop=0;
	while($rec_landing_page_list=mysql_fetch_array($query_landing_page_list))
		{
		$loop++;
		if($loop%2 == 0) 
		{
		$class1="normalActive2";
		$class2="normal2";
		$class3="normal2";
		$class4="gray_sitename2";
		}
		else 
		{
		$class1="normalActive";
		$class2="normal";
		$class3="normal";
		$class4="white_sitename2";
		}	
	
	?>
                                          <tr onmouseover="this.className='<?php echo $class1;?>'" onmouseout="this.className='<?php echo $class2;?>'" class="<?php echo $class3;?>">
                                            <td class="<?php echo $class4;?>" align="center"><?php
		if($rec_landing_page_list['type']=="Click-2-Call")
		{
			$url="landing_page.php";
		}
		elseif($rec_landing_page_list['type']=="lead_generation")
		{
			$url="landing_page_lead_gen.php";
		}
		elseif($rec_landing_page_list['type']=="mobile_flyer")
		{
			$url="landing_page_mob_fly.php";
		}
		elseif($rec_landing_page_list['type']=="rss_feed")
		{
			$url="landing_page_rss.php";
		}
		elseif($rec_landing_page_list['type']=="custom")
		{
			$url="landing_page_custom.php";
		}


?>
                                              <a href="<?php echo $url;?>?id=<?php echo $rec_landing_page_list['landingId'];?>"><?php echo $rec_landing_page_list['pageName'];?></a>&nbsp; </td>
                                            <td class="<?php echo $class4;?>" align="center"><?php echo $rec_landing_page_list['type'];?>&nbsp;</td>
                                            <td class="<?php echo $class4;?>" align="center"><?php echo date("j F, Y",strtotime($rec_landing_page_list[created_date]));?>&nbsp; </td>
                                            <td class="<?php echo $class4;?>" align='center' style="padding-right: 10px"><span onclick="return delete_landing_page(<?php echo $rec_landing_page_list['landingId'];?>);"> <img alt="Delete" src="images/delete.jpg" /> </span>&nbsp; </td>
                                          </tr>
                                          <?php
		}// end while
		}// end if
		else
		{
	?>
                                          <tr>
                                            <td align="center" colspan="4" height="30" class="<?php echo $class4;?>"> No records found </td>
                                          </tr>
                                          <?php
		} // end else
		?>
                                        </table></TD>
                                    </tr>
                                  </table></TD>
                              </tr>
                            </table></td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr>
                    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="11"><img src="images/PinkBorderBottomLeft.jpg" alt="" width="11" height="11"></td>
                          <td class="PinkBoxBottomBg"><img src="images/spacer.gif" alt="" width="10" height="11"></td>
                          <td width="11"><img src="images/PinkBorderBottomRight.jpg" alt="" width="11" height="11"></td>
                        </tr>
                      </table></td>
                  </tr>
                </table>
</form>
</td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
  </div>
<!--</form>-->
<?php
       }
		?>
